package com.neusoft.elm.interfaces.assembler;

import com.neusoft.elm.domain.entity.User;
import com.neusoft.elm.interfaces.dto.UserDTO;

public class UserAssembler {
    
    public static UserDTO toDTO(User user) {
        if (user == null) {
            return null;
        }
        
        UserDTO dto = new UserDTO();
        dto.setUserId(user.getUserId());
        dto.setUserName(user.getUserName());
        dto.setUserSex(user.getUserSex());
        dto.setUserImg(user.getUserImg());
        return dto;
    }
    
    public static User toEntity(UserDTO dto) {
        if (dto == null) {
            return null;
        }
        
        User user = new User();
        user.setUserId(dto.getUserId());
        user.setUserName(dto.getUserName());
        user.setUserSex(dto.getUserSex());
        user.setUserImg(dto.getUserImg());
        return user;
    }
} 